package com.qianfeng.smartplatform.mapper;/*
 *@Description:
 *@author:赵健
 *@Date:zjzzz 2022/9/7 16:40
 */

import com.qianfeng.smartplatform.pojo.SysUserOnline;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface OnLineUserMapper {
    @Insert("INSERT INTO  sys_user_online values (#{sessionId},#{loginName},#{ipaddr},#{loginLocation},#{browser},#{os},#{status},#{startTimestamp},#{lastAccessTime},#{expireTime})")
    void addOnlineData(SysUserOnline sysUserOnline);

    @Select("SELECT login_name FROM sys_user_online WHERE login_name=#{login_name}")
    String dataExist(String loginName);

    @Update("UPDATE sys_user_online SET sessionId=#{sessionId},ipaddr=#{ipaddr},login_location=#{loginLocation},browser=#{browser},os=#{os},status=#{status},start_timestamp=#{startTimestamp},last_access_time=#{lastAccessTime},expire_time=#{expireTime} WHERE login_name =#{loginName}")
    void updateOnlineData(SysUserOnline sysUserOnline);
}
